﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UtilWpf
{
    /// <summary>
    /// UserControlDateTimePicker.xaml 的交互逻辑
    /// </summary>
    public partial class AucDateTimePicker : UserControl
    {
        /// <summary>
        /// 
        /// </summary>
        public AucDateTimePicker()
        {
            InitializeComponent();

            ValueDateTime = DateTime.Now;
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime ValueDateTime
        {
            get 
            {
                var date = (DateTime)DatePickerDate.SelectedDate;
                var time = TimePickerTime.ValueTime;
                return new DateTime(date.Year, date.Month, date.Day, time.Item1, time.Item2, time.Item3);
            }
            set 
            {
                DatePickerDate.SelectedDate = value;
                TimePickerTime.SetTime(value.Hour, value.Minute, value.Second);
            }
        }
    }
}
